<template>
    <el-result  sub-title="页面错误">
      <template #icon>
        <el-image
          src="https://img2.baidu.com/it/u=959393692,738492676&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500"
        />
      </template>
      <template #extra>
        <div>{{time}}S...后跳回首页或者点击下方</div>
        <el-button type="primary" @click="gotoHome">回首页</el-button>
      </template>
    </el-result>
  </template>
  <script lang="ts" setup>
  import { onMounted, ref } from 'vue';
  import { useRouter } from 'vue-router';
  const time = ref(30)
  const router = useRouter()
  const gotoHome = ()=>{
    router.push('/') 
  }
  //时间
  const cutTime=()=>{
    time.value -=1  
    if(time.value==0){
      router.push('/') 
    }
  }
  const Time = ()=>{
    setInterval(()=>{
      cutTime()
    },1000)
  }
  onMounted(()=>{
    Time()
  })
  </script>  